package com.sample.springbatch.scheduler;

import java.util.Date;

/**
 * 调度日志
 *
 * @author zwg
 * @date 2019-05-23 8:55
 **/

public class SchedulerLog {

    private String name;
    private String className;
    private String ip;
    private String message;

    private Date startTime;
    private Date endTime;

    public SchedulerLog(){

    }

    public SchedulerLog(String name, String className, String ip, Date startTime) {
        this.name = name;
        this.className = className;
        this.ip = ip;
        this.startTime = startTime;
    }

    public SchedulerLog end(Date endTime){
        return this.end("",endTime);
    }

    public SchedulerLog end(String message, Date endTime){
        this.message = message;
        this.endTime = endTime;
        return this;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("SchedulerLog{");
        sb.append("name='").append(name).append('\'');
        sb.append(", className='").append(className).append('\'');
        sb.append(", ip='").append(ip).append('\'');
        sb.append(", message='").append(message).append('\'');
        sb.append(", startTime=").append(startTime);
        sb.append(", endTime=").append(endTime);
        sb.append('}');
        return sb.toString();
    }
}
